package com.shushan.home.bean;

import com.android.net.bean.NetBaseBean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @ClassName: MineIndexBean
 * @Desciption: //TODO
 * @author: yichaohua
 * @date: 2018-12-12
 */
public class MineIndexBean extends NetBaseBean {

    public int collect_count;
    public int error_count;
    public int card;

    public String url;
    public String name;
    public String href;

    public int stars;
    public int vip;
    public int extract;

    public int tb_vip = 0;
    public int tb_vip_time;
    public int sz_vip = 0;
    public int sz_vip_time;
    public int ks_vip = 0;
    public int ks_vip_time;
    public int ky_vip = 0;
    public int ky_vip_time;
    public int dc_vip = 0;
    public int dc_vip_time;
    public int tl_vip = 0;
    public int tl_vip_time;

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        collect_count = jsonObject.optInt("collect_count",0);
        error_count = jsonObject.optInt("error_count",0);
        card = jsonObject.optInt("card",0);
        extract = jsonObject.optInt("extract",0);

        JSONArray activityJsonArray = jsonObject.optJSONArray("activity");
        if(activityJsonArray != null){
            JSONObject object = activityJsonArray.optJSONObject(0);
            if(object != null){
                url = object.optString("url","");
                name = object.optString("name","");
                href = object.optString("href","");
            }
        }

        stars = jsonObject.optInt("stars",0);
        vip = jsonObject.optInt("vip",0);

        JSONArray classJsonArray = jsonObject.optJSONArray("classificationvip");
        if(classJsonArray != null){
            JSONObject object = classJsonArray.optJSONObject(0);
            tb_vip = object.optInt("tb_vip",0);
            tb_vip_time = object.optInt("vip_time",0);

            object = classJsonArray.optJSONObject(1);
            sz_vip = object.optInt("sz_vip",0);
            sz_vip_time = object.optInt("vip_time",0);

            object = classJsonArray.optJSONObject(2);
            ks_vip = object.optInt("ks_vip",0);
            ks_vip_time = object.optInt("vip_time",0);

            object = classJsonArray.optJSONObject(3);
            ky_vip = object.optInt("ky_vip",0);
            ky_vip_time = object.optInt("vip_time",0);

            object = classJsonArray.optJSONObject(4);
            dc_vip = object.optInt("dc_vip",0);
            dc_vip_time = object.optInt("vip_time",0);

            object = classJsonArray.optJSONObject(5);
            tl_vip = object.optInt("tl_vip",0);
            tl_vip_time = object.optInt("vip_time",0);
        }
    }
}
